package de.hft.st.algodat.ctt.model;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class ConstraintPeriod extends Constraint {
	private final constraintType cType = Constraint.constraintType.PERIOD;
	private List<Timeslot> timeslots = new ArrayList<Timeslot>();
	
	@Override
	public String toString() {
		String toStr = "Course    |# Constra.|Timeslots (day => period)\n";
		toStr += String.format("%-10s|", course);
		toStr += String.format("%-10s|", timeslots.size());
		for(Iterator<Timeslot> itr = timeslots.iterator();itr.hasNext();) {
			Timeslot helper = itr.next();
			toStr += helper.getDay() + "=>" + helper.getPeriod() + " ";
		}
		return toStr + "\n";
	}

	public ConstraintPeriod(String course, List<String> days,
			List<String> periods) {
		super();
		this.course = course;
		for (int i = 0; i < days.size(); i++) {
			int day = Integer.parseInt(days.get(i));
			int period = Integer.parseInt(periods.get(i));
			this.timeslots.add(new Timeslot(day,period));
		}
	}

	public List<Timeslot> getForbiddenTimeslots() {
		return this.timeslots;
	}
}
